<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<%@ page import="com.msmall.base.util.ConstantDB" language="java"%>
<%@ page import="com.msmall.community.space.util.SpaceConstants" language="java"%>
<c:set var="UNLOCK_STATUS" value="<%=ConstantDB.UNLOCK_STATUS%>"></c:set>
<c:set var="LOCK_STATUS" value="<%=ConstantDB.LOCK_STATUS%>"></c:set>
<c:set var="SPACE_WIDGET_PART_ALBUM" value="<%=SpaceConstants.SPACE_WIDGET_PART_ALBUM%>"></c:set>
<c:set var="DIRECTION_PREVIOUS" value="<%=ConstantDB.DIRECTION_PREVIOUS%>"></c:set>
<c:set var="DIRECTION_NEXT" value="<%=ConstantDB.DIRECTION_NEXT%>"></c:set>

<div class="spashowphoto">
	<div class="spashowphotonav">
		<p class="sHB00 fl" onclick="spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_ALBUM}'/>)">
			我的相册
			 >> 
			<a class="lH00" href="javascript:spaceAlbumList(${album.albumid})">
				<c:out value="${album.title}"/>
			</a>
			<c:if test="${not empty photo.title }">
				>> 
				<a class="lH00" href="#">
					<c:out value="${photo.title}"/>
				</a>
			</c:if>
		</p>
		<p class="fl" style="margin-top:-4px">
			<a class="but82" href="javascript:spaceAlbumCover(${album.albumid}, ${photo.photoid})">
				设为封面
			</a>
		</p>
	</div>
	<table class="spashowphototable" cellspacing="0" cellpadding="0" border="0">
		<tbody>
			<tr valign="middle" align="center">
				<td width="120px">
					<c:if test="${album.counts >1}">
					<a href="javascript:spaceAlbumPhotoView(${photo.photoid},${DIRECTION_PREVIOUS})">
						<img src="${ctx}/images/spacebg/lb_03.jpg">
					</a>
					</c:if>
				</td>
				<td>
					<div class="sphotopic">
						<p>
						<img src="${ctx}/${photo.fullPath}">
						</p>
					</div>
					<p class="sphotomessp">
						<span class="fl">
							<c:if test="${not empty photo.title }">
								<a class="lH00" href="#">
									<c:out value="${photo.title}"/>
								</a>
							</c:if>
						</span>
						<span class="fr">
							赞(<c:out value="${photo.topAmount}"></c:out>) 
							评论(<c:out value="${photo.replyAmount}"></c:out>)
							<a class="lc00" href="#">删除</a>
						</span>
					</p>
				</td>
				<td width="120px">
					<c:if test="${album.counts >1}">
					<a href="javascript:spaceAlbumPhotoView(${photo.photoid},${DIRECTION_NEXT})">
						<img src="${ctx}/images/spacebg/lb_05.jpg">
					</a>
					</c:if>
				</td>
			</tr>
		</tbody>
	</table>
	<div class="sdailydiscussdiv">
		<div class="sdailydiscuss">
			<div id="div_photo_reply_error" style="display:none"></div>
			<br>
			<form id="f_new_photo_reply" action="<c:url value='/photo/saveReply.do'/>" method="post">
				<input id="f_new_photo_pid" type="hidden" name="photoid" value="${photo.photoid}"/>
				<p>
					<textarea id="f_new_photo_reply_content" name="content" class="sdailydisform"></textarea>
				</p>
				<p class="martop10">
				<a class="but82" href="javascript:ajaxSubmitPhotoReply('f_new_photo_reply', 'div_photo_reply_error', 'dl_photo_reply_new', 'f_new_photo_reply_content');">发表评论</a>
				</p>
			</form>
		</div>
		<dl id="dl_photo_reply_new" class="sphotodisdl" style="display:none">
			<dt>
			</dt>
			<dd>
				<p id="dd_photo_reply_new">
				</p>
			</dd>
			<p class="clear"></p>
		</dl>
		<c:forEach var="replyvo" items="${replys}" varStatus="stat">
			<dl class="sphotodisdl">
				<dt>
					<c:set var="avatarpath"><ms:user type="avatar" link="false" userid="${replyvo.reply.userid}" nickname="" style=""/></c:set>
					<img style="width:48px;height:48px;" src="${ctx}/${avatarpath}">
				</dt>
				<dd>
					<p>
						<span class="sB00">
							<ms:user type="nickname" link="true" userid="${replyvo.reply.userid}" nickname="" style=""></ms:user>
						</span>
						<fmt:formatDate value="${thread.createTime}" pattern="yyyy-MM-dd HH:mm"/>
						<br>
						<c:out value="${replyvo.reply.content}"></c:out>
						<br>
						<c:set var="replyParentid" value="${replyvo.reply.replyid}"></c:set>
						<c:if test="${not empty replyvo.subs}">
							<c:forEach var="replyvos" items="${replyvo.subs}" varStatus="stat1">
								<ms:user type="nickname" link="true" userid="${replyvos.reply.userid}" nickname="" style=""></ms:user>
								:&nbsp;&nbsp;&nbsp;&nbsp;
								<c:out value="${replyvos.reply.content}"></c:out>
								<br>
								<a class="lc00" href="#">删除</a>
								<br>
								<c:set var="replyParentid" value="${replyvos.reply.replyid}"></c:set>
							</c:forEach>
						</c:if>
						<a class="lc00" href="#">回复</a>
						<a class="lc00" href="#">删除</a>
					</p>
				</dd>
				<p class="clear"></p>
			</dl>
		</c:forEach>
		
	</div>
</div>
<script>
function ajaxSubmitPhotoReply(formid, errorid, newid, contentid){
	$("#"+errorid).html();
	$("#"+errorid).css("display", "none");
	$.ajax({
		type : "POST",
		url : $("#"+formid).attr('action'),
		data : $("#"+formid).serialize(),
		dataType:"xml", 
		timeout:20000,
		success : function(data){
			if($(data).find('result').text().toUpperCase().indexOf("TRUE") < 0){
				$("#"+errorid).html($(data).find('content').text());
				$("#"+errorid).css("display", "block");
			}else{
				$("#"+dd_photo_reply_new).html("您的回复正等待审核....");
				$("#"+newid).css("display", "block");
				$("#"+contentid).val('');
			}
		},
		error: function(){
		}
	});
}
</script>